1
|
|
|
/* |
2
|
|
|
* CMS Pico - Integration of Pico within your files to create websites. |
3
|
|
|
* |
4
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
5
|
|
|
* later. See the COPYING file. |
6
|
|
|
* |
7
|
|
|
* @author Maxence Lange <[email protected]> |
8
|
|
|
* @copyright 2017 |
9
|
|
|
* @license GNU AGPL version 3 or any later version |
10
|
|
|
* |
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
14
|
|
|
* License, or (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* This program is distributed in the hope that it will be useful, |
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19
|
|
|
* GNU Affero General Public License for more details. |
20
|
|
|
* |
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
23
|
|
|
* |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
/** global: OC */ |
28
|
|
|
/** global: OCA */ |
29
|
|
|
/** global: Notyf */ |
30
|
|
|
/** global: pico_elements */ |
31
|
|
|
/** global: pico_nav */ |
32
|
|
|
/** global: pico_result */ |
33
|
|
|
|
34
|
|
|
var pico_define = { |
35
|
|
|
sites: '/sites/', |
36
|
|
|
index: '', |
37
|
|
|
nchost: '' |
38
|
|
|
}; |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
$(document).ready(function () { |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @constructs CMSPico |
45
|
|
|
*/ |
46
|
|
|
var CMSPico = function () { |
47
|
|
|
|
48
|
|
|
$.extend(CMSPico.prototype, pico_nav); |
49
|
|
|
$.extend(CMSPico.prototype, pico_elements); |
50
|
|
|
$.extend(CMSPico.prototype, pico_result); |
51
|
|
|
|
52
|
|
|
this.initialize(); |
53
|
|
|
this.retrieveWebsites(); |
54
|
|
|
}; |
55
|
|
|
|
56
|
|
|
CMSPico.prototype = { |
57
|
|
|
|
58
|
|
|
initialize: function () { |
59
|
|
|
pico_define.nchost = window.location.protocol + '//' + window.location.host; |
60
|
|
|
pico_elements.initElements(); |
61
|
|
|
pico_elements.initUI(); |
62
|
|
|
pico_elements.initTweaks(); |
63
|
|
|
|
64
|
|
|
pico_define.index = OC.getRootPath(); |
65
|
|
|
if (oc_config.modRewriteWorking !== true) { |
|
|
|
|
66
|
|
|
pico_define.index += '/index.php'; |
67
|
|
|
} |
68
|
|
|
}, |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
retrieveWebsites: function () { |
72
|
|
|
|
73
|
|
|
$.ajax({ |
74
|
|
|
method: 'GET', |
75
|
|
|
url: OC.generateUrl('/apps/cms_pico/personal/websites'), |
76
|
|
|
data: {} |
77
|
|
|
}).done(function (res) { |
78
|
|
|
pico_result.displayWebsites(res.websites); |
79
|
|
|
}); |
80
|
|
|
|
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
}; |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @constructs Notification |
88
|
|
|
*/ |
89
|
|
|
var Notification = function () { |
90
|
|
|
this.initialize(); |
91
|
|
|
}; |
92
|
|
|
|
93
|
|
|
Notification.prototype = { |
94
|
|
|
|
95
|
|
|
initialize: function () { |
96
|
|
|
|
97
|
|
|
var notyf = new Notyf({ |
98
|
|
|
delay: 5000 |
99
|
|
|
}); |
100
|
|
|
|
101
|
|
|
this.onSuccess = function (text) { |
102
|
|
|
notyf.confirm(text); |
103
|
|
|
}; |
104
|
|
|
|
105
|
|
|
this.onFail = function (text) { |
106
|
|
|
notyf.alert(text); |
107
|
|
|
}; |
108
|
|
|
|
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
}; |
112
|
|
|
|
113
|
|
|
OCA.CMSPico = CMSPico; |
114
|
|
|
OCA.CMSPico.manage = new CMSPico(); |
115
|
|
|
|
116
|
|
|
OCA.Notification = Notification; |
117
|
|
|
OCA.notification = new Notification(); |
118
|
|
|
|
119
|
|
|
}); |
120
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.